#ifndef COLORBUTTON_H
#define COLORBUTTON_H

#include <QAbstractButton>

class ColorButton : public QAbstractButton
{
Q_OBJECT
public:
    explicit ColorButton(QWidget *parent = 0);
    void setColor(const QColor &color);
    QColor color() const;
    QSize sizeHint() const;
    QSize minimumSizeHint() const;

protected:
    void paintEvent(QPaintEvent *event);
    void leaveEvent(QEvent *event);
    void enterEvent(QEvent *event);

signals:
    void colorChanged(const QColor &);

private slots:
    void changeColor();

private:
    enum {depth = 3, roundness = 20};
    bool _inside;
    QColor _color;
    void draw(QPainter *painter);

};

#endif // COLORBUTTON_H
